# -*- coding: utf-8 -*- 
"""
========================================================================================================================
@project : my-sanic
@file: myError
@Author: mengying
@email: 652044581@qq.com
@date: 2023/3/3 10:32
@desc: 定义系统所需要报错类型
========================================================================================================================
"""
from utils.myLog import SeqLog

logger = SeqLog().get_logger()


class MyError(BaseException):
    """所有错误的基类，必须重新错误处理和日志记录"""

    def __init__(self, message):
        self.message = message
        self.error_handler()
        self.log_record()

    def error_handler(self):
        pass

    def log_record(self):
        logger.debug("MyError记录错误消息: %s" % str(self.message))


class O2OAError(MyError):

    def __init__(self, message):
        super(O2OAError, self).__init__(message)

    def error_handler(self):
        pass

    def log_record(self):
        logger.debug("O2OAError记录错误消息: %s" % str(self.message))


if __name__ == '__main__':
    raise O2OAError('错误')

